package com.feihao.zhou.UDP.demo02MutiTest;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class SendDemo {
    public static void main(String[] args) throws IOException {
        //创建发送端对象
        DatagramSocket ds  = new DatagramSocket();

        String s = "组播信息";

        byte[] bytes = s.getBytes();

        InetAddress address = InetAddress.getByName("224.0.1.0");

        //打包：
        DatagramPacket dp = new DatagramPacket(bytes,bytes.length,address,10022);

        //发送：
        ds.send(dp);

        ds.close();
    }
}
